package com.demo.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.github.pagehelper.PageHelper;

import com.generator.tools.text.Convert;
import com.demo.mapper.OrderMapper;
import com.demo.service.IOrderService;
import com.demo.entity.Order;

import java.util.List;

/**
 * 
 *
 * @author blue demon
 * @date 2020/02/08
 */
@Service
public class OrderServiceImpl implements IOrderService {

	@Autowired
	private OrderMapper orderMapper;

	/**
	 * 通过Id查询 Order
	 */
	@Override
	public Order selectOrderById(long id) {
		return orderMapper.selectOrderById(id);
	}

	/**
	 * 查询Order列表
	 */

	@Override
  	public List<Order> selectOrderList(Order order,int pageNum,int pageSize){
		return  PageHelper.startPage(pageNum,pageSize).doSelectPage(()->orderMapper.selectOrderList(order));
 	}

	/**
     * 新增Order
     */
	@Override
	public int insertOrder(Order order) {
		return orderMapper.insertOrder(order);
	}

	/**
	 * 通过id删除Order
	 */
	@Override
	public int deleteOrderById(long id) {
		return orderMapper.deleteOrderById(id);
	}

	/**
	 * 通过id批量删除Order
	 */
	@Override
	public int deleteOrderByIds(String ids){
		return orderMapper.deleteOrderByIds(Convert.toStrArray(ids));
	 }

	/**
	 * 修改Order信息
	 */
	@Override
	public int updateOrder(Order order) {
		return orderMapper.updateOrder(order);
	}

}